﻿using System.Web.Mvc;
using SilenthinkCommon.Extension;

namespace Web.Areas.Passport
{
    public class PassportAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "Passport";
            }
        }

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.Routes.MapSubDomainRoute(
           "Me", AreaName.ToLower(), // SubDomain
           "me.js", // Url
           new { controller = "Home", action = "Me" }, // Defaults
           new[] { "Web.Areas.Passport.Controllers" }); // Namespace

            context.Routes.MapSubDomainRoute(
            "LogOff", AreaName.ToLower(), // SubDomain
            "LogOff", // Url
            new { controller = "Home", action = "LogOff" }, // Defaults
            new[] { "Web.Areas.Passport.Controllers" }); // Namespace

            context.Routes.MapSubDomainRoute(
               "PassportDefault", AreaName.ToLower(), // SubDomain
               "{controller}/{action}/{param}", // Url
               new { controller = "Home", action = "Index", param = UrlParameter.Optional }, // Defaults
               new[] { "Web.Areas.Passport.Controllers" }); // Namespace
        }
    }
}
